#ifndef __STRLCPY_H__
#define __STRLCPY_H__
 
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */

#include <stddef.h>
#include <stdint.h>

#include "json.h"

/** safe strcpy.
 * @param dest Target memory pointer.
 * @param src Source memory pointer.
 * @param size The size of str_dst array length.
 * @return The length of the actual copied string.
 * 	copy error, -1 is returned.
 */
size_t strlcpy(char *dst, const char *src, size_t siz);


/** get child string object value from json_object.
 * @param src_jso father json object.
 * @param key key name of child json object.
 * @param str_dst The location where the string data is stored.
 * @param str_dst The size of str_dst array length.
 * @return Parse success, 0 is returned.
 * 	copy error, -1 is returned.
 */
int strlcpy_by_jso_key(const json_object *src_jso, const char *key, char *str_dst, size_t size);

/** 获取json内字符串子对象的字符串值的指针.
 * @param src_jso father json object.
 * @param key key name of child json object.
 * @return success, Returns a pointer to the target string.
 * 	error, NULL is returned.
 */
const char *string_get_by_jso_key(const json_object *src_jso, const char *key);

/** 获取json内字 int 对象的数值.
 * @param src_jso father json object.
 * @param key key name of child json object.
 * @return success, int value is returned.
 * 	error, NULL is returned, printf error.
 */
int int_get_by_jso_key(const json_object *src_jso, const char *key);

/** 获取json内 double 对象的数值.
 * @param src_jso father json object.
 * @param key key name of child json object.
 * @return success, double value is returned.
 * 	error,  0 is returned.
 */
double double_get_by_jso_key(const json_object *src_jso, const char *key);

/** 获取json内 bool 对象的值.
 * @param src_jso father json object.
 * @param key key name of child json object.
 * @return success, true(1) or false(0) is returned.
 * 	error,  -1 is returned.
 */
json_bool bool_get_by_jso_key(const json_object *src_jso, const char *key);



size_t strlcat(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t siz);

int uuid2str(uint64_t uuid, char* s, uint8_t len);



#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /**__STRLCPY__*/


